# -*- coding: utf-8 -*-
'''
Created on August 19, 2013

@author: Alivn

the base event for events
'''

from actions import *

class BaseAction:

	def render_template(self,actionPrefix,pageTmpl,**args):

		cookiesLanguageValue = request.cookies.get('__CookieLanguageKey')
		resKey = 'zh_CN' if cookiesLanguageValue is None else cookiesLanguageValue
		localRes = localResource.getResources(resKey)
		if localRes is None:
			return "The localResource 【%s】 is not exist! please check the folder local." % resKey

		pageRes = localRes[actionPrefix]
		if pageRes is None:
			pageRes = {}
			#return "The localResource 【resource_%s.strings】 does not contain the second level 【%s --- %s】 branch!" % (resKey,self.eventPrefix,actionPrefix)

		layoutRes = localRes["layout"]
		return render_template(pageTmpl,user_info = None,pageRes = pageRes,layoutRes = layoutRes,**args)


